<template>
  <div class="app-container">
    <list-page-container>
      <template slot="query">
        <el-form :model="tableQueryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
          <el-form-item label="" prop="keyword">
            <el-input
                v-model="tableQueryParams.keyword"
                placeholder="请输入保单名称/保险单号码"
                clearable
                style="width: 300px"
                @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item label="" prop="keyword">
            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
          </el-form-item>
          <el-form-item label="保单类型" prop="repairState">
            <el-select @change="handleQuery" v-model="tableQueryParams.orderType">
              <el-option
                  v-for="dict in dict.type.enum_order_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-form>
      </template>

      <template slot="rowHandel">
        <!--        <el-button icon="el-icon-refresh" size="mini" @click="proofread">保单校对</el-button>-->
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleAdd">新增保单</el-button>
      </template>

      <template slot="table">
        <el-table @sort-change="handleSortChange" height="100%" v-loading="loading" :data="dataList">
          <el-table-column label="保单名称" align="center" prop="bdbt"/>
          <el-table-column label="保险单号" align="center" prop="bxdhm"/>
          <el-table-column label="承保公司" align="center" prop="yf"/>
          <el-table-column label="投保人" align="center" prop="tbr"/>
          <el-table-column label="总保险金额（元）" align="center" prop="zbxjeSz"/>
          <el-table-column label="保险期间" align="center" prop="zbxjeSz">
            <template slot-scope="scope">
              {{ `${scope.row.bxks}-${scope.row.bxjs}` }}
            </template>
          </el-table-column>
          <el-table-column width="200" label="操作" align="center" class-name="small-padding fixed-width">
            <template slot-scope="scope">
              <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-edit"
                  @click="handleInfo(scope.row)"
              >查看
              </el-button>
              <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-edit"
                  @click="handleUpdate(scope.row)"
              >修改
              </el-button>
              <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-delete"
                  @click="handleDelete(scope.row)"
              >删除
              </el-button>
            </template>
          </el-table-column>
        </el-table>
      </template>

      <template slot="pageDisplay">
        <pagination
            v-show="total>0"
            :total="total"
            :page.sync="tableQueryParams.pageNum"
            :limit.sync="tableQueryParams.pageSize"
            @pagination="getList"
        />
      </template>
    </list-page-container>
  </div>

</template>

<script>
import {listPageMixins} from "@/mixins/listPageMixins";
import {HIDDEN_DANGER_WIDTH} from "@/constantData";
import {isArr} from "@/utils/arrayUtil";
import ShowFileList from "@/components/ShowFileList/index.vue";
import {UploadFileObj} from "@/utils/uploadFile";
import guid from "@/utils/guid";
import {deleteOrder, queryOrderBase} from "@/api/chit/chitListPage";

export default {
  dicts: ['enum_order_type'],
  mixins: [listPageMixins],
  components: {
    ShowFileList,
  },
  data() {
    return {
      HIDDEN_DANGER_WIDTH,
      modelName: '保单',
      insuranceUid: `f${guid()}`,
      insuranceDetailUid: `f${guid()}`,
      // 查询参数
      queryParams: {
        // 保单类型
        orderType: null,
        // 保单名称/号码
        keyword: null,
      },
      otherQueryParam: {
        // checkId: this.danInfoData.id,
      },
      getListFun: queryOrderBase,
      // addFun: defectSupervisionQuestionCheckAddQuestion,
      // updateFun: defectSupervisionQuestionCheckUpdateQuestion,
      // getInfoFun: getQuestionDetail,
      deleteFun: deleteOrder,

    }
  },

  methods: {
    handleAdd() {
      this.$router.push({path: '/chit/chitAdd'})
    },
    handleUpdate(row){
      this.$router.push({path: '/chit/chitAdd', query: {chitId: row.id}})
    },
    handleInfo(row) {
      this.$router.push({path: '/chit/chitInfoLook', query: {chitId: row.id}})
    },
    proofread() {
    },

  },
}
</script>

<style scoped>

</style>
